<html>
<head><meta charset="utf-8"><title>rust-analyzer setup · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html">rust-analyzer setup</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="226406881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226406881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226406881">(Feb 15 2021 at 16:47)</a>:</h4>
<p>Hi, I'm trying to setup RA to work with the rust repo. I copy pasted the settings.json file, but it is throwing the following error when I save.</p>
<div class="codehilite"><pre><span></span><code>[Error - 10:14:50 pm] Request textDocument/formatting failed.
  Message: The system cannot find the file specified. (os error 2)
  Code: -32603
</code></pre></div>
<p>Has someone encountered this before?</p>



<a name="226409033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226409033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226409033">(Feb 15 2021 at 17:08)</a>:</h4>
<p>You mean from <a href="https://rustc-dev-guide.rust-lang.org/building/suggested.html">https://rustc-dev-guide.rust-lang.org/building/suggested.html</a>?</p>



<a name="226409118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226409118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226409118">(Feb 15 2021 at 17:09)</a>:</h4>
<p>Did you replace <code>TARGET_TRIPLE</code> with your target triple? And have you run <code>./x.py</code> before? Otherwise rustfmt is not yet downloaded.</p>



<a name="226415759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226415759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226415759">(Feb 15 2021 at 18:13)</a>:</h4>
<p>Yeah, I have compiled the build target with <code>./x.py build library/std</code> and replaced the <code>TARGET_TRIPLE</code>.</p>



<a name="226476732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226476732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226476732">(Feb 16 2021 at 06:25)</a>:</h4>
<p>I have tested my rust_analyzer setup with a sample project, so I don't think it is a problem with it. Is it possible it is not able to access rustfmt properly?</p>



<a name="226477258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226477258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226477258">(Feb 16 2021 at 06:34)</a>:</h4>
<p>Also, rust_analyzer seems to complain about cyclic deps in the project.</p>
<div class="codehilite"><pre><span></span><code>[ERROR project_model::workspace] cyclic deps: cargo_test_support(CrateId(143)) -&gt; cargo(CrateId(127))
[ERROR project_model::workspace] cyclic deps: rustc_std_workspace_core(CrateId(1194)) -&gt; core(CrateId(199)
</code></pre></div>



<a name="226490229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226490229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226490229">(Feb 16 2021 at 09:29)</a>:</h4>
<p>I'm using rust-analyzer on the compiler source without any special configuration, it just works out of the box. Perhaps try using it without the suggested configuration?</p>



<a name="226492486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226492486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226492486">(Feb 16 2021 at 09:52)</a>:</h4>
<p>I can't believe that actually worked. Thanks!</p>



<a name="226492554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226492554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226492554">(Feb 16 2021 at 09:53)</a>:</h4>
<p>It does throw a bunch of errors in the console though</p>



<a name="226492838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226492838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226492838">(Feb 16 2021 at 09:55)</a>:</h4>
<p>I think rust analyzer is marking up parts of the compiler source as erroneous. Any ideas why that might be?</p>
<p><a href="/user_uploads/4715/hfwOAhNDGqJFIXnHR39tqqeG/rustcErrors.PNG">rustcErrors.PNG</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/hfwOAhNDGqJFIXnHR39tqqeG/rustcErrors.PNG" title="rustcErrors.PNG"><img src="/user_uploads/4715/hfwOAhNDGqJFIXnHR39tqqeG/rustcErrors.PNG"></a></div>



<a name="226493174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226493174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226493174">(Feb 16 2021 at 09:58)</a>:</h4>
<p>I don't know the reason, but you can just ignore those and it works fine most of the time. You can jump to a definition, use hovers, use code actions, see types of variables etc. even with those errors.</p>



<a name="226493637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226493637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226493637">(Feb 16 2021 at 10:02)</a>:</h4>
<p>I see. Thanks again.</p>



<a name="226493881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226493881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226493881">(Feb 16 2021 at 10:04)</a>:</h4>
<p>without the configuration, it'll try to run <code>cargo check</code> on the compiler, which doesn't work</p>



<a name="226493931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226493931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226493931">(Feb 16 2021 at 10:04)</a>:</h4>
<p>you could also disable checkOnSave instead  of changing the command to x.py</p>



<a name="226493978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226493978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226493978">(Feb 16 2021 at 10:05)</a>:</h4>
<p>and you're going to potentially use the wrong rustfmt</p>



<a name="226494700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226494700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226494700">(Feb 16 2021 at 10:11)</a>:</h4>
<p>It is strange. I tried to add the config again, this time through Workspace settings rather directly and it works fine now</p>



<a name="226494742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226494742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nipun Garg <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226494742">(Feb 16 2021 at 10:12)</a>:</h4>
<p>I am not sure what the problem was though</p>



<a name="226517404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-analyzer%20setup/near/226517404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> asquared31415 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-analyzer.20setup.html#226517404">(Feb 16 2021 at 14:15)</a>:</h4>
<p>Rust analyzer really struggles with the rustc source sometimes in my experience as well.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>